package com.huluobo.a2107kotlinshopping.net

import com.huluobo.a2107kotlinshopping.FoodBeanResult
import com.huluobo.a2107kotlinshopping.cart.CartBeanResult
import com.huluobo.a2107kotlinshopping.cart.ChangeCartBeanResult
import com.huluobo.a2107kotlinshopping.category.CategoryBeanResult
import com.huluobo.a2107kotlinshopping.category.CategoryGoodsBeanResult
import com.huluobo.a2107kotlinshopping.detail.AddToCartBeanResult
import com.huluobo.a2107kotlinshopping.detail.GoodsDetailBeanResult
import com.huluobo.a2107kotlinshopping.home.HomeBannerBeanResult
import com.huluobo.a2107kotlinshopping.home.HomeGoodsBeanResult
import com.huluobo.a2107kotlinshopping.home.HomeNavBeanResult
import com.huluobo.a2107kotlinshopping.login.UserBeanResult
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *  Created by LC on 2023/11/13.
 */
interface ApiService {
    @GET(Const.URL_FOOD)
    fun getFoods(): Observable<FoodBeanResult>

    @POST(Const.URL_LOGIN)
    fun login(@Body body: RequestBody): Observable<UserBeanResult>

    @POST(Const.URL_REGISTER)
    fun register(@Body body: RequestBody): Observable<UserBeanResult>

    @GET(Const.URL_HOME_GOODS_LIST)
    fun getHomeGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<HomeGoodsBeanResult>

    @GET(Const.URL_HOME_BANNER)
    fun getHomeBanner(): Observable<HomeBannerBeanResult>

    @GET(Const.URL_HOME_NAV)
    fun getHomeNav(): Observable<HomeNavBeanResult>

    @GET(Const.URL_GOODS_DETAIL)
    fun getGoodsDetail(@Query(Const.PARAM_GOODS_ID) goodsId: Int): Observable<GoodsDetailBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun addToCart(@Body body: RequestBody): Observable<AddToCartBeanResult>

    @GET(Const.URL_GET_CART_LIST)
    fun getCartList(): Observable<CartBeanResult>

    @GET(Const.URL_GET_CATEGORY)
    fun getCategory(): Observable<CategoryBeanResult>

    @GET(Const.URL_GET_CATEGORY_GOODS_LIST)
    fun getCategoryGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<CategoryGoodsBeanResult>

    @POST(Const.URL_DELETE_CART)
    fun deleteCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun changeCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>
}